Authentication
Mission Control supports two authentication modes: Local (single-token) and Clerk (multi-user JWT).Authentication Modes
Local Mode
Local mode uses a single shared bearer token for self-hosted deployments. This is ideal for personal instances.Configuration
Set these environment variables: Backend (backend/.env)
frontend/.env.local)
How It Works
- Browser sends requests with
Authorization: Bearer <LOCAL_AUTH_TOKEN> - Backend compares using constant-time comparison (line 422 in
auth.py) - If valid, creates/returns user with email
admin@home.local - User is automatically assigned to an organization
backend/app/core/auth.py:410-427
Clerk Mode
Clerk mode enables multi-user authentication with JWT verification.Configuration
Backend (backend/.env)
frontend/.env.local)
How It Works
- Browser obtains JWT from Clerk UI
- Sends requests with
Authorization: Bearer <jwt> - Backend verifies JWT signature using Clerk public key
- Extracts
sub(user ID),email, andnamefrom JWT claims - Creates/updates user record in database
- Ensures user is a member of an organization
backend/app/core/auth.py:435-474
Agent Authentication
Agents authenticate usingX-Agent-Token header instead of bearer tokens.
Agent Token Flow
Agent provisioning
When an agent is created, Mission Control generates a unique token and stores its hash in
agents.agent_token_hash.Agent-Accessible Endpoints
Endpoints under/api/v1/agent/* require agent authentication:
| Endpoint | Description |
|---|---|
GET /agent/boards | List boards accessible to agent |
GET /agent/boards/{id}/tasks | List tasks on board |
PATCH /agent/boards/{id}/tasks/{tid} | Update task status/fields |
POST /agent/boards/{id}/tasks/{tid}/comments | Add task comments |
GET/POST /agent/boards/{id}/memory | Read/write board memory |
POST /agent/approvals/{id}/review | Review approvals |
backend/app/api/deps.py
Bootstrap Flow
The bootstrap endpoint resolves the caller’s identity:- Verify authentication
- Load user profile
- Determine
isAdminstatus for UI rendering
Organization Roles
Each user has a role in their organization:- Owner: Full control, can delete organization
- Admin: Can manage agents, gateways, and boards
- Member: Can view boards they have access to
backend/app/api/organizations.py:402-416
Troubleshooting
”Only organization owners and admins can access agents”
Causes:- Token not loaded → Check
NEXT_PUBLIC_LOCAL_AUTH_TOKEN - CORS blocking membership check → Add origin to
CORS_ORIGINS - Timezone not set → Complete onboarding at
/onboarding
CORS Issues
Ensure the browser’s origin is inCORS_ORIGINS:
Backend .env:
Security Best Practices
- Generate strong tokens for local mode (50+ characters)
- Use HTTPS in production for Clerk mode
- Rotate tokens if compromised
- Set minimum gateway version via
GATEWAY_MIN_VERSION - Enable device pairing unless using
control_uimode